package com.wyy.stujpa.entity;

import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "course")
public class Course {
    @Id
    @Column(name = "c_id")
    private String cId;
    @Column(name = "c_name")
    private String cName;
    @Column(name = "c_redit")
    private Integer cRedit;
    //课程找到学生
    @ManyToMany(fetch = FetchType.EAGER,cascade = CascadeType.ALL)
    @JoinTable(name = "cou_stu",//cou_stu：中间表
            joinColumns = {@JoinColumn(name = "c_id")},//中间表相关的列名
            inverseJoinColumns = {@JoinColumn(name = "stu_id")})//中间表相关的列名
    private List<Student> stus;

    public String getcId() {
        return cId;
    }

    public void setcId(String cId) {
        this.cId = cId;
    }

    public String getcName() {
        return cName;
    }

    public void setcName(String cName) {
        this.cName = cName;
    }

    public Integer getcRedit() {
        return cRedit;
    }

    public void setcRedit(Integer cRedit) {
        this.cRedit = cRedit;
    }

    public List<Student> getStus() {
        return stus;
    }

    public void setStus(List<Student> stus) {
        this.stus = stus;
    }
}
